<template>
  <div>Item</div>
</template>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  name: "Item",
});
</script>

<script setup lang="ts">
import { watch } from "vue";
import { useRoute } from "vue-router";
const route = useRoute();

watch(
  route,
  () => {
    // 可以通过route拿到值
    console.log(route, "route");
    console.log(route.params, "route");
    console.log(route.query, "route");
  },
  {
    immediate: true, //立即监听
  }
);
</script>

<style scoped></style>
